﻿namespace ProjetoModeloDDD.Application
{
    using System;
    using System.Collections.Generic;

    using ProjetoModeloDDD.Application.Interface;
    using ProjetoModeloDDD.Domain.Interfaces.Services;

    public class AppServiceBase<TEntity> : IDisposable, IAppServiceBase<TEntity> where TEntity : class
    {
        private readonly IServiceBase<TEntity> _serviceBase;

        public AppServiceBase(IServiceBase<TEntity> serviceBase)
        {
            this._serviceBase = serviceBase;
        }

        public void Add(TEntity obj)
        {
            this._serviceBase.Add(obj);
        }

        public TEntity GetById(int id)
        {
            return this._serviceBase.GetById(id);
        }

        public IEnumerable<TEntity> GetAll()
        {
            return this._serviceBase.GetAll(); 
        }

        public void Update(TEntity obj)
        {
            this._serviceBase.Update(obj);
        }

        public void Remove(TEntity obj)
        {
           this._serviceBase.Remove(obj);
        }

        public void Dispose()
        {
            this._serviceBase.Dispose();
        }
    }
}
